@@ -71,6 +71,7 @@ urlpatterns += [ |
||
71 | 71 |
urlpatterns += [ |
72 | 72 |
url(r'^op/upgrade$', op_views.upgrade_api, name='upgrade_api'), # APP 升级 |
73 | 73 |
url(r'^op/splash$', op_views.splash_api, name='splash_api'), # 启动页面 |
74 |
+ url(r'^op/feedback$', op_views.feedback_api, name='feedback_api'), # 用户反馈 |
|
74 | 75 |
] |
75 | 76 |
|
76 | 77 |
# 支付相关 |
@@ -2,7 +2,7 @@ |
||
2 | 2 |
|
3 | 3 |
from django.contrib import admin |
4 | 4 |
|
5 |
-from operation.models import LatestAppInfo, SplashInfo |
|
5 |
+from operation.models import LatestAppInfo, SplashInfo, FeedbackInfo |
|
6 | 6 |
|
7 | 7 |
|
8 | 8 |
class LatestAppInfoAdmin(admin.ModelAdmin): |
@@ -13,5 +13,10 @@ class SplashInfoAdmin(admin.ModelAdmin): |
||
13 | 13 |
list_display = ('splash_image', 'spalash_image_airtime', 'spalash_image_deadline', 'status', 'created_at', 'updated_at') |
14 | 14 |
|
15 | 15 |
|
16 |
+class FeedbackInfoAdmin(admin.ModelAdmin): |
|
17 |
+ list_display = ('user_id', 'feedback', 'status', 'created_at', 'updated_at') |
|
18 |
+ |
|
19 |
+ |
|
16 | 20 |
admin.site.register(LatestAppInfo, LatestAppInfoAdmin) |
17 | 21 |
admin.site.register(SplashInfo, SplashInfoAdmin) |
22 |
+admin.site.register(FeedbackInfo, FeedbackInfoAdmin) |
@@ -0,0 +1,29 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+from __future__ import unicode_literals |
|
3 |
+ |
|
4 |
+from django.db import models, migrations |
|
5 |
+ |
|
6 |
+ |
|
7 |
+class Migration(migrations.Migration): |
|
8 |
+ |
|
9 |
+ dependencies = [ |
|
10 |
+ ('operation', '0002_auto_20160120_1830'), |
|
11 |
+ ] |
|
12 |
+ |
|
13 |
+ operations = [ |
|
14 |
+ migrations.CreateModel( |
|
15 |
+ name='FeedbackInfo', |
|
16 |
+ fields=[ |
|
17 |
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
|
18 |
+ ('status', models.BooleanField(default=True, help_text='\u72b6\u6001', db_index=True, verbose_name='status')), |
|
19 |
+ ('created_at', models.DateTimeField(help_text='\u521b\u5efa\u65f6\u95f4', verbose_name='created_at', auto_now_add=True)), |
|
20 |
+ ('updated_at', models.DateTimeField(help_text='\u66f4\u65b0\u65f6\u95f4', verbose_name='updated_at', auto_now=True)), |
|
21 |
+ ('user_id', models.CharField(help_text='\u7528\u6237\u552f\u4e00\u6807\u8bc6', max_length=255, null=True, verbose_name='user_id', blank=True)), |
|
22 |
+ ('feedback', models.TextField(help_text='\u7528\u6237\u53cd\u9988', null=True, verbose_name='feedback', blank=True)), |
|
23 |
+ ], |
|
24 |
+ options={ |
|
25 |
+ 'verbose_name': 'feedbackinfo', |
|
26 |
+ 'verbose_name_plural': 'feedbackinfo', |
|
27 |
+ }, |
|
28 |
+ ), |
|
29 |
+ ] |
@@ -71,3 +71,15 @@ class SplashInfo(CreateUpdateMixin): |
||
71 | 71 |
} |
72 | 72 |
|
73 | 73 |
data = property(_data) |
74 |
+ |
|
75 |
+ |
|
76 |
+class FeedbackInfo(CreateUpdateMixin): |
|
77 |
+ user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识') |
|
78 |
+ feedback = models.TextField(_(u'feedback'), blank=True, null=True, help_text=u'用户反馈') |
|
79 |
+ |
|
80 |
+ class Meta: |
|
81 |
+ verbose_name = _('feedbackinfo') |
|
82 |
+ verbose_name_plural = _('feedbackinfo') |
|
83 |
+ |
|
84 |
+ def __unicode__(self): |
|
85 |
+ return u'{0.pk}'.format(self) |
@@ -2,6 +2,12 @@ |
||
2 | 2 |
|
3 | 3 |
from django.http import JsonResponse |
4 | 4 |
|
5 |
+from account.models import UserInfo |
|
6 |
+from operation.models import FeedbackInfo |
|
7 |
+ |
|
8 |
+from utils.error.errno_utils import UserStatusCode |
|
9 |
+from utils.error.response_utils import response |
|
10 |
+ |
|
5 | 11 |
from operation.models import LatestAppInfo, SplashInfo |
6 | 12 |
|
7 | 13 |
|
@@ -41,3 +47,28 @@ def splash_api(request): |
||
41 | 47 |
'splashes': splashes, |
42 | 48 |
}, |
43 | 49 |
}) |
50 |
+ |
|
51 |
+ |
|
52 |
+def feedback_api(request): |
|
53 |
+ """ |
|
54 |
+ 用户反馈 |
|
55 |
+ :param request: |
|
56 |
+ :return: |
|
57 |
+ """ |
|
58 |
+ user_id = request.POST.get('user_id', '') |
|
59 |
+ feedback = request.POST.get('feedback', '') |
|
60 |
+ |
|
61 |
+ if not UserInfo.objects.filter(user_id=user_id).exists(): |
|
62 |
+ return response(UserStatusCode.USER_NOT_FOUND) |
|
63 |
+ |
|
64 |
+ FeedbackInfo.objects.create( |
|
65 |
+ user_id=user_id, |
|
66 |
+ feedback=feedback |
|
67 |
+ ) |
|
68 |
+ |
|
69 |
+ return JsonResponse({ |
|
70 |
+ 'status': 200, |
|
71 |
+ 'message': u'反馈成功', |
|
72 |
+ 'data': { |
|
73 |
+ }, |
|
74 |
+ }) |